realmcrafterfandomcom-20200216-history
Pet Wait Script
Created by Taz. Using "RC_Core.rcm" ; By Tazco ;Will be used to make a pet Wait in place Function Main() Player = Actor() Target = ContextActor() ;------------------------------------------------------------------------------------------------ ;tamed pet follow. StoredTamedID% = Split(ActorGlobal(Player, 3), 21, "|") If (StoredTamedID > 0) ;Check Tamed Pet Health see if its still alive. TamedHP% = Attribute(StoredTamedID, "Health") If (TamedHP > 0) ;tamed npc is alive so kill it. BubbleOutPut(Player, "Stay Pet! ") SetActorAIState(StoredTamedID, 7) Return Else OutPut(Player, "You dont have a pet out.", 255, 127, 21) Return EndIf EndIf ;End tamed pet follow. ;------------------------------------------------------------------------------------------------ PName$ = Name(Player) TName$ = Name(Target) PetID$ = ActorID("Gremlin", "") ;pet id Petname$ = "Gremlin" ;Pet Name PetFound% = 0 ;Used for repeat if = 1 end repeat ;Look for actor pet ;Repeat ;--------------------------------Vampire Check---------------------------------------------------------------------------------- ;If vamp dont tell player they cant use a pet in this form IsVamp% = ActorId("Vampire", "Form") PRace$ = Race(Player) PClass$ = Class(Player) PlayerID% =ActorID(PRace, PClass) If(IsVamp = PlayerID) ;if player is a vampire OutPut(Player, "You can not use a human pet in vampire form.", 255, 34, 12) Return EndIf ;----------------------------End Vampire Check---------------------------------------------------------------------------------- PetToFind$ = FindActor(Petname, 2) ;type 2 search through NPCs PetTag$ = Tag(PetToFind) NpcName$ = Name(PetToFind) ;found actor name PetOwnerName$ = ActorGlobal(PetToFind, 1) ;check for pet owner name. FirstPet$ = PetTag ;Tag of first pet in zone found. ;Look for actor pet Repeat ;check if player has a pet already ;OutPut(Player, "Stored pet name " + PetOwnerName) If (PetOwnerName = Pname) EndRepeat% = 1 Else If Not (PetTag = + PName + "s Pet") ;If npc found is a gremlin pet PetToFind$ = NextActorInZone(PetToFind) NpcName$ = Name(PetToFind) ;found actor name PetTag$ = Tag(PetToFind) PetOwnerName$ = ActorGlobal(PetToFind, 1) ;check for pet owner name. EndIf EndIf DoEvents(1) Until (PetTag = + PName + "s Pet") or (PetTag = FirstPet) or (EndRepeat = 1) ;end if pet is out check If (PetOwnerName = Pname) BubbleOutPut(Player, "Stay Pet! ") SetActorAIState(PetToFind, 7) ;set pet to wait in place ;Play random animation on wait command for pet. PickAni% = Rand(1, 4) If (PickAni = 1) AnimateActor(PetToFind, "Drooling", .5, 2) DoEvents(18000) EndIf If (PickAni = 2) AnimateActor(PetToFind, "Scared", .5, 2) DoEvents(18000) EndIf If (PickAni = 3) AnimateActor(PetToFind, "Crying", .5, 2) DoEvents(18000) EndIf If (PickAni = 4) AnimateActor(PetToFind, "Tired", .5, 2) DoEvents(18000) EndIf EndIf ;Until (PetFound = 1) ;end gremlin pet PetID$ = ActorID("RockHead", "") ;pet id Petname$ = "RockHead" ;Pet Name PetFound% = 0 ;Used for repeat if = 1 end repeat ;Look for actor pet ;Repeat PetToFind$ = FindActor(Petname, 2) ;type 2 search through NPCs NpcName$ = Name(PetToFind) ;found actor name If (NpcName = Petname) ;If npc found is a gremlin pet PetOwnerName$ = ActorGlobal(PetToFind, 1) ;check for pet owner name. If (PetOwnerName = PName) ;see if pet found is players pet. Check stored name to player name. BubbleOutPut(Player, "Stay!") SetActorAIState(PetToFind, 7) ;set pet to wait in place PetFound = 1 EndIf EndIf DoEvents(10) If (PetOwnerName = "") PetFound = 1 EndIf ;Until (PetFound = 1) ;end rockhead pet DoEvents(1000) AnimateActor(PetToFind, "Idle3", .5, 2) End Function